home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 273_01 / melt.cc < prev    next >
Text File  |  1988-02-09  |  2KB  |  118 lines

  1. #include <ctype.h>
  2. melt(int attr, char type)
  3. /* Melt will clear the screen in various ways and will set the attributes to
  4.    attr.
  5.    type = t,b,l,r,a
  6.           t=clear from top to bottom
  7.           b=clear from bottom to top
  8.           l=clear from left to right
  9.           r=clear from right to left
  10.           a=implode screen (clear from outside to inside)
  11. */
  12. {
  13.   extern int color, mono, cga, ega, scrseg, bios;
  14.   int   row, col, orow, ocol, row2, col2;
  15.   type = toupper(type);
  16.   delay(1);
  17.   if(bios) get_cur(&orow,&ocol);
  18.  
  19.     if(type == 'T') {
  20.         for(row=0; row < 25; row++) {
  21.             for(col=0; col < 80; col++) {
  22.                 if(bios) {
  23.                     locate(row,col);
  24.                     put_ca(' ',attr,1);
  25.                 }
  26.                 else
  27.                     writefc(row,col,attr,' ');
  28.             }
  29.             delay(10);
  30.         }
  31.     }
  32.  
  33.  
  34.  
  35.     if(type == 'B') {
  36.         for(row=24; row >=0; row--) {
  37.             for(col=0; col < 80; col++) {
  38.                 if(bios) {
  39.                     locate(row,col);
  40.                     put_ca(' ',attr,1);
  41.                 }
  42.                 else
  43.                     writefc(row,col,attr,' ');
  44.             }
  45.             delay(10);
  46.         }
  47.     }
  48.  
  49.  
  50.     if(type == 'L') {
  51.         for(col=0; col < 80; col++) {
  52.             for(row=0; row < 25; row++) {
  53.                 if(bios) {
  54.                     locate(row,col);
  55.                     put_ca(' ',attr,1);
  56.                 }
  57.                 else
  58.                     writefc(row,col,attr,' ');
  59.             }
  60.             delay(5);
  61.         }
  62.     }
  63.  
  64.  
  65.     if(type == 'R') {
  66.         for(col=79; col >=0; col--) {
  67.             for(row=0; row < 25; row++) {
  68.                 if(bios) {
  69.                     locate(row,col);
  70.                     put_ca(' ',attr,1);
  71.                 }
  72.                 else
  73.                     writefc(row,col,attr,' ');
  74.             }
  75.             delay(5);
  76.         }
  77.     }
  78.     if(type == 'A') {
  79.         for(row2=0,col2=0; col2 < 15;row2++,col2++) {
  80.             for(col=col2; col <= (79-col2); col++) {
  81.                 if(bios) {
  82.                     locate(row2,col);
  83.                     put_ca(' ',attr,1);
  84.                 }
  85.                 else
  86.                     writefc(row2,col,attr,' ');
  87.             }
  88.             for(row=row2; row <= (24-row2); row++) {
  89.                 if(bios) {
  90.                     locate(row,79- col2);
  91.                     put_ca(' ',attr,1);
  92.                 }
  93.                 else
  94.                     writefc(row,79 - col2,attr,' ');
  95.             }
  96.             for(col=(79-col2); col >= col2; col--) {
  97.                 if(bios) {
  98.                     locate(24 - row2,col);
  99.                     put_ca(' ',attr,1);
  100.                 }
  101.                 else
  102.                     writefc(24 - row2,col,attr,' ');
  103.             }
  104.             for(row=(24 - row2); row >=row2; row--) {
  105.                 if(bios) {
  106.                     locate(row,col2);
  107.                     put_ca(' ',attr,1);
  108.                 }
  109.                 else
  110.                     writefc(row,col2,attr,' ');
  111.             }
  112.             delay(10);
  113.         }
  114.     }
  115.     if(bios) locate(orow,ocol);
  116.     return(0);
  117. }
  118.